/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package character_6;

/**
 *
 * @author Administrator
 */
public abstract class GuessGame {
    public void go(){
        int number = (int) (Math.random() * 10);
        int guess;
        do {            
            print("输入数字：");
            guess = nextInt();
        } while (guess != number);
        println("猜中了");
    }
    
    public void println(String text){
        print(text + "\n");
    }
    
    public abstract void print(String text);
    public abstract int nextInt();
    
}
